package com.share.admin.model.vo;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author 01401061 - 孙艳强
 * @date 2020/11/10 2:31
 */
@Data
public class MenuVo implements Comparable<MenuVo>, Serializable {

    private Long id;


    private Long pid;


    private String name;

    /**
     * 浏览器地址栏路径
     */
    private String path;

    //vue文件路径
    private String component;

    //图标
    private String icon;

    /**
     * 节点类型，1文件夹，2页面，3按钮
     */

    private String nodeType;

    private Integer sort;

    private List<MenuVo> children;

    @Override
    public int compareTo(MenuVo o) {
        //空值处理
        Integer sort0 = this.getSort();
        Integer sort1 = o.getSort();
        if (sort0 == null) {
            sort0 = 0;
        }
        if (sort1 == null) {
            sort1 = 0;
        }

        //开始比较
        if (sort0 > sort1) {
            return 1;
        } else if (sort0 < sort1) {
            return -1;
        } else {
            return 0;
        }
    }
}
